home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / aessrc12 / aesutob1.s < prev    next >
Text File  |  1990-11-23  |  5KB  |  109 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8. ;*************************************************************************
  9. ;*
  10. ;* AESUTOB1.S - Object-related utilities 1 of n.
  11. ;*  Non-standard utility functions.
  12. ;*
  13. ;*************************************************************************
  14.          
  15.           .extern   _objc_draw          ; We call this standard AES func.
  16.           .extern   _objcl_calc         ; We call this non-standard util.
  17.           
  18.           .include  "gemfast.sh"        ; Pull in header file.
  19.  
  20. ;-------------------------------------------------------------------------
  21. ; objfl_change - Set or reset object flag, optionally update screen.
  22. ;                If high bit of new flags is set (negative) the flags
  23. ;                will be ANDed, otherwise they're ORed.  Confused?  This
  24. ;                allows the following to work as you'd expect:
  25. ;
  26. ; objfl_change(maintree, BOX3,  HIDETREE, TRUE): /* hide   box3, redraw /
  27. ; objfl_change(maintree, BOX3, ~HIDETREE, TRUE): /* unhide box3, redraw */ 
  28. ;
  29. ;  void objfl_change(tree, object, flagmask, update);
  30. ;-------------------------------------------------------------------------
  31.  
  32. _objfl_change::
  33.  
  34.           .cargs    #8,.ptree.l,.obj.w,.flag.w,.update.w
  35.           link      a6,#0
  36.           
  37.           move.l    .ptree(a6),a0       ; Build a pointer to the
  38.           move.w    .obj(a6),d0         ; desired object in
  39.           muls      #OBJ_SIZ,d0         ; the tree.
  40.           add.l     d0,a0
  41.           
  42.           move.w    .flag(a6),d0        ; Get/check the flag(s) to change.
  43.           bmi.s     .reset              ; If neg, we need to reset flag,
  44.           or.w      d0,ob_flags(a0)     ; else we set flag,
  45.           bra.s     .checkupdate        ; and continue below.
  46. .reset:
  47.           and.w     d0,ob_flags(a0)     ; Reset the flag.
  48. .checkupdate:
  49.           tst.w     .update(a6)         ; Does caller want objc_draw?
  50.           beq.s     .done               ; If not, we're done.
  51.  
  52.           clr.l     -(sp)
  53.           clr.l     -(sp)               ; Allocate clipping rectangle then
  54.           move.l    sp,(sp)             ; make 1st long point to itself.
  55.           move.w    .obj(a6),-(sp)      ; Stack the tree and object index,
  56.           move.l    .ptree(a6),-(sp)    ; and call the grect clip calc'er.
  57.           jsr       _objcl_calc         ; It will overlay the pointer we
  58.           addq.l    #6,sp               ; stacked with the clip info, clean
  59.           move.w    #9,-(sp)            ; the stack up to the clip info, 
  60.           clr.w     -(sp)               ; then stack up objc_draw parms to
  61.           move.l    .ptree(a6),-(sp)    ; to a redraw of the whole tree,
  62.           jsr       _objc_draw          ; clipped by the object we changed.
  63. .done:
  64.           unlk      a6                  ; Unstack everything, and
  65.           rts                           ; return to caller.
  66.           
  67. ;-------------------------------------------------------------------------
  68. ; objst_change - Set or reset object state, optionally update screen.
  69. ;                If high bit of new flags is set (negative) the flags
  70. ;                will be ANDed, otherwise they're ORed.  Confused?  This
  71. ;                allows the following to work as you'd expect:
  72. ;
  73. ; objst_change(maintree, BTN3,  SELECTED, TRUE): /* sel    btn3, redraw /
  74. ; objst_change(maintree, BTN3, ~SELECTED, TRUE): /* desel  btn3, redraw */ 
  75. ;
  76. ;  void objst_change(tree, object, flagmask, update);
  77. ;-------------------------------------------------------------------------
  78.  
  79. _objst_change::
  80.  
  81.           .cargs    #8,.ptree.l,.obj.w,.flag.w,.update.w
  82.           link a6,#0
  83.           
  84.           move.l    .ptree(a6),a0       ; Build a pointer to the
  85.           move.w    .obj(a6),d0         ; desired object in
  86.           muls      #OBJ_SIZ,d0         ; the tree.
  87.           add.l     d0,a0
  88.           
  89.           move.w    .flag(a6),d0        ; Get/check the flag(s) to change.
  90.           bmi.s     .reset              ; If neg, we need to reset flag,
  91.           or.w      d0,ob_state(a0)     ; else we set flag,
  92.           bra.s     .checkupdate        ; and continue below.
  93. .reset:
  94.           and.w     d0,ob_state(a0)     ; Reset the flag.
  95. .checkupdate:
  96.           tst.w     .update(a6)         ; Does caller want objc_draw?
  97.           beq.s     .done               ; If not, we're done.
  98.  
  99.           move.l    #$7FFF7FFF,-(sp)    ; Do objc_draw on object, with
  100.           clr.l     -(sp)               ; a max-sized clipping rectangle.
  101.           move.w    #9,-(sp)            ; 
  102.           move.w    .obj(a6),-(sp)      ; Start draw at changed object.
  103.           move.l    .ptree(a6),-(sp)    ; 
  104.           jsr       _objc_draw          ; Go do it.
  105. .done:
  106.           unlk      a6                  ; Unstack everything, and
  107.           rts                           ; return to caller.
  108.           
  109.